<script setup lang="ts">
import { storeToRefs } from 'pinia'
import { useHomeStore } from '@/sotre/home'
const homeStore = useHomeStore()
const { updatePhone } = useHomeStore()
const { dataList, greenPhone } = storeToRefs(homeStore)
</script>

<template>
    <ul>
        <li
            v-for="{ nickName, price, color } in dataList"
            :key="price"
        >
            {{ nickName }}-{{ price }}-{{ color }}
        </li>
    </ul>
    <div>
        greens
        <span
            v-for="item in greenPhone"
            :key="item.price"
        >
            {{ item.nickName }}-
        </span>
    </div>
    <button
        @click="
            updatePhone({
                nickName: 'oppo',
                price: 999,
                color: 'green'
            })
        "
    >
        添加
    </button>
</template>
